import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/views/login/index'
import changePass from '@/views/login/changePass'
import registerIndex from '@/views/login/registerIndex'
import dashboard from '@/views/dashboard/index'
import orderIndex from '@/views/orderList/index'
import notFound from '@/views/404'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Login',
      component: Login,
      meta: {
        title: '掌上菜单管理系统_登录'
      }
    },
    {
      path: '/changePass',
      name: 'changePass',
      component: changePass,
      meta: {
        title: '掌上菜单管理系统_修改密码'
      }
    },
    {
      path: '/registerIndex',
      name: 'registerIndex',
      component: registerIndex,
      meta: {
        title: '掌上菜单管理系统_注册'
      }
    },
    {
      path: '/orderIndex',
      name: 'orderIndex',
      component: orderIndex,
      meta: {
        title: '掌上菜单'
      }
    },
    {
      path: '/dashboard',
      name: 'dashboard',
      component: dashboard,
      children: [
        {
          title: '商家管理',
          path: '/business-manage',
          name: 'business-manage',
          meta: {
            title: '掌上菜单管理系统_商家管理'
          },
          component: () => import('@/views/business-manage')
        },
        {
          title: '商家详情',
          path: '/business-details',
          name: 'business-details',
          meta: {
            title: '掌上菜单管理系统_商家详情'
          },
          component: () => import('@/views/business-manage/details')
        },
        {
          title: '菜品类型管理',
          path: '/variety-of-dishes-type-manage',
          name: 'variety-of-dishes-type-manage',
          meta: {
            title: '掌上菜单管理系统_菜品类型管理'
          },
          component: () => import('@/views/variety-of-dishes-type-manage')
        },
        {
          title: '菜品类型详情',
          path: '/dishes-type-details',
          name: 'dishes-type-details',
          meta: {
            title: '掌上菜单管理系统_菜品类型详情'
          },
          component: () => import('@/views/variety-of-dishes-type-manage/details')
        },
        {
          title: '菜品管理',
          path: '/variety-of-dishes-manage',
          name: 'variety-of-dishes-manage',
          meta: {
            title: '掌上菜单管理系统_菜品管理'
          },
          component: () => import('@/views/variety-of-dishes-manage')
        },
        {
          title: '菜品详情',
          path: '/dishes-manage-details',
          name: 'dishes-manage-details',
          meta: {
            title: '掌上菜单管理系统_菜品详情'
          },
          component: () => import('@/views/variety-of-dishes-manage/details')
        }
      ]
    },
    {
      path: '*',
      component: notFound,
      meta: {
        title: 'Error'
      },
    }
  ]
})
